﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WD.Properties;
using WD.Classes;

namespace WD
{
    public partial class settingsForm : Form
    {
        public settingsForm()
        {
            InitializeComponent();
        }

        private void settingsForm_Load(object sender, EventArgs e)
        {
            this.Text = Resources.settingsForm;
            
            settingsClass objSetting = new settingsClass();

            objSetting.ACTIVITY_LOG_ATTRIB_TEXT = Properties.Settings.Default.ACTIVITY_LOG_ATTRIB_TEXT;
            objSetting.ACTIVITY_LOG_REMIND_AFTER_MINUTES = Properties.Settings.Default.ACTIVITY_LOG_REMIND_AFTER_MINUTES.ToString();

            this.m_propertyGrid.SelectedObject = objSetting;
            this.m_propertyGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(PropertyGrid1_PropertyValueChanged);
        }



        private void PropertyGrid1_PropertyValueChanged(Object sender, PropertyValueChangedEventArgs e)
        {
            switch (e.ChangedItem.Label)
            {
                //set { this["XXXXXXXXXXXX"] = value; }
                case "ACTIVITY_LOG_ATTRIB_TEXT":
                    Properties.Settings.Default.ACTIVITY_LOG_ATTRIB_TEXT = e.ChangedItem.Value.ToString();
                    Properties.Settings.Default.Save();
                    break;
                case "ACTIVITY_LOG_REMIND_AFTER_MINUTES":
                    Properties.Settings.Default.ACTIVITY_LOG_REMIND_AFTER_MINUTES = uint.Parse(e.ChangedItem.Value.ToString());
                    Properties.Settings.Default.Save();
                    break;
            }
        }
    }
}
